package com.hycas.method;
//可变参数传参
public class Demo07 {
    public static void main(String[] args) {
        //调用可变参数传参
        printMax(1,3,5);
        printMax(new double[]{1,45,99,1084});

    }
    public static void printMax(double...num){
        if(num.length==0){
            System.out.println("wrong");
            return;
        }
        double result = num[0];
        //排序
        for (int i = 1; i < num.length ; i++) {
            if(num[i]>result){
                result = num[i];
            }
        }
        System.out.println(result);
    }
}
